<?php

use frontend\models\User;

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../config/bootstrap.php';

/**
 * 向此容器注册一个类定义
 */
Yii::$container->set(User::class, [
    'id'   => 1,
    'name' => 'Grey',
    'age' => 26
]);

/**
 * 实例化的三种方法
 */
$user1 = Yii::$container->get(User::class);
$user2 = Yii::createObject(User::class);
$user3 = \yii\di\Instance::ensure(User::class);

die(0);